feat(mcp): add LSP 3.17 tools and MCP resources for diagnostics#124
Merged
Conversation
…#115) Issue #116 — add four missing LSP tools: - get_signature_help: textDocument/signatureHelp (LSP 3.15) - go_to_implementation: textDocument/implementation (LSP 3.6) - go_to_type_definition: textDocument/typeDefinition (LSP 3.6) - get_inlay_hints: textDocument/inlayHint (LSP 3.17) All tools follow the existing 1-based MCP position convention and degrade gracefully when the LSP server does not support the capability. Issue #115 — expose LSP diagnostics as subscribable MCP resources: - resources/list returns lsp-diagnostics:/// URIs for open documents - resources/read returns cached diagnostics as JSON - resources/subscribe / unsubscribe register interest in push updates - Split-phase diagnostics_pump caches PublishDiagnostics before the MCP peer is captured, then fires notify_resource_updated for subscribed URIs URI codec (bridge::resources) uses url::Url::from_file_path for RFC 3986-conformant percent-encoding. Subscription set is capped at 1 000 entries. Workspace-root containment is enforced in both read_resource and subscribe via validate_path. Closes #116, Closes #115
Remove spawn_batch_with_notifications and spawn_with_notifications (no longer needed now that LspServer carries notification_rx directly). Add LspServer::take_notification_rx to extract the receiver before registering the server with the translator, replacing it with a dummy channel so the struct remains fully initialized. Extract register_servers helper to keep serve() within the 100-line clippy limit. Handle LspNotification::Progress variant added in main to fix the non-exhaustive match in diagnostics_pump.
bug-ops
added a commit
that referenced
this pull request
Apr 29, 2026
Add 7 sub-cases to ra_e2e_suite: - sc_get_signature_help, sc_go_to_implementation, sc_go_to_type_definition, sc_get_inlay_hints — cover the 4 tools added in #124 that had no e2e coverage against real rust-analyzer - sc_list_resources, sc_read_resource, sc_subscribe_unsubscribe_resource — cover the MCP resources path (list/read/subscribe/unsubscribe) end-to-end Add list_resources, read_resource, subscribe_resource, unsubscribe_resource to McpClient test helper. Add lib_rs_uri() helper that derives the lsp-diagnostics:// URI from the live resources/list response to avoid path-encoding drift on macOS canonicalised paths. Append lsp317_target() to the rust_workspace fixture as a stable anchor for the new sub-cases (append-only, no existing anchors disturbed). Closes #129, closes #130
bug-ops
added a commit
that referenced
this pull request
May 1, 2026
…#139) Add 7 sub-cases to ra_e2e_suite: - sc_get_signature_help, sc_go_to_implementation, sc_go_to_type_definition, sc_get_inlay_hints — cover the 4 tools added in #124 that had no e2e coverage against real rust-analyzer - sc_list_resources, sc_read_resource, sc_subscribe_unsubscribe_resource — cover the MCP resources path (list/read/subscribe/unsubscribe) end-to-end Add list_resources, read_resource, subscribe_resource, unsubscribe_resource to McpClient test helper. Add lib_rs_uri() helper that derives the lsp-diagnostics:// URI from the live resources/list response to avoid path-encoding drift on macOS canonicalised paths. Append lsp317_target() to the rust_workspace fixture as a stable anchor for the new sub-cases (append-only, no existing anchors disturbed). Closes #129, closes #130
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements two features together:
Issue #116 — 4 new LSP tools:
get_signature_help—textDocument/signatureHelp(LSP 3.15): method parameter hints at call-site positiongo_to_implementation—textDocument/implementation(LSP 3.6): navigate from trait/interface to concrete implementationsgo_to_type_definition—textDocument/typeDefinition(LSP 3.6): navigate to the type definition of an expressionget_inlay_hints—textDocument/inlayHint(LSP 3.17): inline type annotations over a rangeAll tools follow the existing 1-based MCP position convention and degrade gracefully when the LSP server lacks the capability.
Issue #115 — MCP resources for diagnostics:
resources/listreturnslsp-diagnostics:///URIs for open documentsresources/readreturns cached diagnostics as JSONresources/subscribe/unsubscriberegister interest in push updatesdiagnostics_pump: starts before MCP serve to avoid dropping first-paint diagnostics, firesnotify_resource_updatedfor subscribed URIs once peer is capturedurl::Url::from_file_pathwith percent-encodingread_resourceandsubscribeviavalidate_pathRefactoring (post-rebase cleanup):
spawn_batch_with_notifications(superseded byLspServer.notification_rxadded in main)LspServer::take_notification_rxto extract receiver before server registrationLspNotification::Progressvariant indiagnostics_pumpTest plan
cargo +nightly fmt --all -- --checkpassescargo clippy --all-targets --all-features --workspace -- -D warningspassescargo nextest run --workspace --all-features --lib --bins— 380/380 tests passRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featurespassesresources/listreturns URIs for open documentsCloses #116, Closes #115